🐍 Python & Spyder IDE Installation Guide

BTech 2nd Semester - Python Programming Lab

Instructor: Mohsin Dar
Purpose: First Lab Setup Guide

Windows Installation

Method 1: Anaconda Distribution

Complete package with Python, Spyder, and scientific libraries pre-installed.

Recommended for Beginners

Method 2: Standalone Installation

Install Python and Spyder separately with more control.

Advanced

1Download Anaconda

Visit the official Anaconda website and download the Windows installer (64-bit recommended).

Download Anaconda for Windows

Step-by-step download process:

Anaconda Website Download Page

Step 1: Navigate to Anaconda download page and click download

Anaconda Download Selection

Step 2: Select Windows installer and download

Note: The download is approximately 1.2 GB. Make sure you have a stable internet connection.

2Run the Installer

  • Double-click the downloaded .exe file
  • Click "Next" to begin installation
  • Read and accept the license agreement
  • Choose "Just Me" (recommended) for installation type
  • Select installation location (default is fine)

3Important Installation Options

⚠️ Important: On the "Advanced Installation Options" screen:
  • ✅ Check "Add Anaconda to my PATH environment variable" (makes it easier to use)
  • ✅ Check "Register Anaconda as my default Python"

Click "Install" and wait for the installation to complete (may take 10-15 minutes).

4Launch Spyder IDE

After installation:

  • Open the Start Menu
  • Search for "Anaconda Navigator" or "Spyder"
  • Click on Spyder to launch the IDE
Tip: You can also launch Spyder directly from the Start Menu without opening Anaconda Navigator.

1Download Python from Official Website

Visit the official Python website to download the latest version:

Download Python for Windows
  • Open https://www.python.org/downloads/ in your browser
  • The website will automatically detect your Windows system and recommend the latest stable version
  • Click the "Download Python" button to download the Windows installer (usually a .exe file)
  • Save the file to your Downloads folder or preferred location
💡 Tip: Download the 64-bit version unless you have a very old 32-bit system. Most modern computers are 64-bit.

2Run the Python Installer

  • Navigate to your Downloads folder and double-click the Python installer (.exe file)
  • The installer window will open with installation options
  • CRITICAL: At the bottom of the first screen, check the box that says "Add Python to PATH"
  • Click "Install Now" for the default installation (recommended for beginners)
  • Alternatively, click "Customize installation" for more control over installation options
⚠️ Important: Checking "Add Python to PATH" is essential! This allows you to run Python from any command prompt window.

3Complete Installation

  • Wait for the installation progress to complete (usually 2-5 minutes)
  • If you chose "Customize installation", you can select optional features and installation location
  • Once installation is complete, click "Close"
💡 Tip: If you see a "Setup was successful" message, Python has been installed correctly!

4Verify Python Installation

Open Command Prompt (search for "cmd" in Start Menu) and type:

python --version

You should see the Python version number displayed (e.g., "Python 3.12.0").

💡 Tip: If you get an error, try typing "py" instead of "python", or restart your computer and try again.

5Install pip (Package Manager)

pip is Python's package manager that allows you to install additional packages. Modern Python installations usually include pip, but here's how to verify and install it:

Check if pip is already installed:

pip --version

If pip is not installed, install it using:

python -m ensurepip --upgrade

Or download and install pip manually:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
Note: After installing pip, you can use it to install any Python package with: pip install package_name

6Install Spyder

In the Command Prompt, run:

pip install spyder

Wait for the installation to complete (may take a few minutes).

Note: This command installs Spyder and all its dependencies using Python's package manager (pip).

7Launch Spyder

In Command Prompt, type:

spyder

Or search for "Spyder" in the Start Menu.

💡 Tip: The first launch may take a minute as Spyder initializes its environment.

✅ Verify Your Installation

Open Spyder and type the following in the console:

print("Hello, Python!")
import sys
print(sys.version)

If you see "Hello, Python!" and the Python version, your installation is successful!

macOS Installation

Method 1: Anaconda Distribution

Complete package with Python, Spyder, and scientific libraries pre-installed.

Recommended for Beginners

Method 2: Standalone Installation

Install Python and Spyder separately with more control.

Advanced

1Download Anaconda

Visit the official Anaconda website and download the macOS installer.

Download Anaconda for macOS
Note: Choose the appropriate version for your Mac (Intel or Apple Silicon M1/M2).

2Run the Installer

  • Open the downloaded .pkg file
  • Follow the installation wizard
  • Click "Continue" through the introduction screens
  • Accept the license agreement
  • Select the installation destination (default is fine)
  • Click "Install" and enter your Mac password if prompted

3Complete Installation

Wait for the installation to complete (may take 10-15 minutes).

Tip: You can skip the PyCharm installation offer at the end.

4Launch Spyder IDE

  • Open "Anaconda Navigator" from Applications or Launchpad
  • Click on "Launch" under Spyder
  • Alternatively, open Terminal and type: spyder

1Download Python from Official Website

Visit the official Python website to download the latest version for macOS:

Download Python for macOS
  • Open https://www.python.org/downloads/ in your browser
  • The website will automatically detect your macOS and recommend the latest stable version
  • Click the "Download Python" button to download the macOS installer (.pkg file)
  • Choose the correct version for your Mac (Intel or Apple Silicon M1/M2)
💡 Tip: To check your Mac type, go to Apple menu → About This Mac. Look for "Chip" information (Intel or Apple Silicon).
Note: macOS comes with Python 2.7 pre-installed. Make sure to install Python 3.x for this course.

2Install Python

  • Navigate to your Downloads folder and double-click the Python installer (.pkg file)
  • The installer window will open - click "Continue" to proceed
  • Read and agree to the license agreement, then click "Continue"
  • Select the installation destination (default is usually fine)
  • Click "Install" and enter your Mac password when prompted
  • Wait for the installation to complete (usually 2-5 minutes)
💡 Tip: The installer will automatically add Python 3 to your PATH, so you can use it from Terminal.

3Verify Python Installation

Open Terminal (Applications → Utilities → Terminal) and type:

python3 --version

You should see the Python version number displayed (e.g., "Python 3.12.0").

Note: On macOS, you need to use "python3" instead of "python" to avoid conflicts with the pre-installed Python 2.7.

4Install pip (Package Manager)

pip is Python's package manager that allows you to install additional packages. Modern Python installations usually include pip, but here's how to verify and install it:

Check if pip is already installed:

pip3 --version

If pip is not installed, install it using:

python3 -m ensurepip --upgrade

Or download and install pip manually:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py
Note: After installing pip, you can use it to install any Python package with: pip3 install package_name

5Install Spyder

In Terminal, run:

pip3 install spyder

Wait for the installation to complete (may take a few minutes).

💡 Tip: Use "pip3" to ensure you're installing packages for Python 3, not Python 2.7.

6Launch Spyder

In Terminal, type:

spyder

Alternatively, you can find Spyder in your Applications folder.

💡 Tip: The first launch may take longer as Spyder sets up its environment.

✅ Verify Your Installation

Open Spyder and type the following in the console:

                            print("Hello, Python!")
                            import sys
                            print(sys.version)
                        

If you see "Hello, Python!" and the Python version, your installation is successful!

Linux Installation

Method 1: Anaconda Distribution

Complete package with Python, Spyder, and scientific libraries pre-installed.

Recommended for Beginners

Method 2: Standalone Installation

Install Python and Spyder separately using package manager.

Advanced

1Download Anaconda

Visit the official Anaconda website and download the Linux installer.

Download Anaconda for Linux
Note: Choose the 64-bit (x86) installer for most modern systems.

2Install Anaconda

Open Terminal and navigate to your Downloads folder:

cd ~/Downloads

Run the installer (replace filename with your downloaded file):

bash Anaconda3-2024.02-1-Linux-x86_64.sh
Tip: Press Enter to review the license, then type "yes" to accept.

3Complete Installation

  • Confirm the installation location (press Enter for default)
  • Type "yes" when asked to initialize Anaconda
  • Close and reopen your Terminal

4Launch Spyder IDE

In Terminal, type:

anaconda-navigator

Then click "Launch" under Spyder, or directly run:

spyder

1Download Python from Official Website

Visit the official Python website to download the latest version for Linux:

Download Python for Linux
  • Open https://www.python.org/downloads/ in your browser
  • The website will recommend the latest stable version
  • Click "Download Python" and select "Linux" from the download options
  • Download the source code tarball (.tar.xz file) or the Gzipped source tarball (.tar.gz)
  • Save the file to your Downloads folder
💡 Tip: Downloading from source gives you the latest version and more control, but requires compilation. Package manager installation is easier but may have older versions.

2Install Dependencies and Compile Python

First, install the build dependencies:

For Ubuntu/Debian:

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

For Fedora:

sudo dnf groupinstall "Development Tools"
sudo dnf install zlib-devel ncurses-devel gdbm-devel nss-devel openssl-devel readline-devel libffi-devel wget

Now extract and compile Python:

cd ~/Downloads
tar -xf Python-3.12.0.tar.xz
cd Python-3.12.0
./configure --enable-optimizations
⚠️ Important: Use "make altinstall" instead of "make install" to avoid overwriting the system's default Python.
make -j 4
sudo make altinstall
⚠️ Important: Use "make altinstall" instead of "make install" to avoid overwriting the system's default Python.

3Alternative: Package Manager Installation

If you prefer an easier method, use your distribution's package manager:

For Ubuntu/Debian:

sudo apt update
sudo apt install python3 python3-pip

For Fedora:

sudo dnf install python3 python3-pip

For Arch Linux:

sudo pacman -S python python-pip
💡 Tip: Package manager versions may be older than the latest release from python.org.

4Verify Python Installation

In Terminal, type:

python3 --version

Or if you compiled from source:

python3.12 --version

You should see the Python version number displayed.

5Install pip (Package Manager)

pip is Python's package manager that allows you to install additional packages. Here's how to verify and install it:

Check if pip is already installed:

pip3 --version

If pip is not installed, install it using:

For Ubuntu/Debian:

sudo apt install python3-pip

For Fedora:

sudo dnf install python3-pip

For Arch Linux:

sudo pacman -S python-pip

Or install pip using Python's built-in module:

python3 -m ensurepip --upgrade

Or download and install pip manually:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
Note: After installing pip, you can use it to install any Python package with: pip3 install package_name

6Install Spyder

Using pip (recommended for latest version):

pip3 install spyder

Or using your distribution's package manager:

Ubuntu/Debian:

sudo apt install spyder

Fedora:

sudo dnf install spyder
💡 Tip: pip installation usually provides a more recent version of Spyder.

7Launch Spyder

In Terminal, type:

spyder

You can also find it in your applications menu or by searching for "Spyder".

💡 Tip: If Spyder doesn't launch, try running it with python3: python3 -m spyder

✅ Verify Your Installation

Open Spyder and type the following in the console:

print("Hello, Python!")
import sys
print(sys.version)

If you see "Hello, Python!" and the Python version, your installation is successful!